<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    if (path.length() > 0) path = path.substring(0, path.length() - 1);
%>
<jsp:include flush="true" page="/view/inc/incTop.jsp"/>
<!-- head-->
<script language="javascript">
    function check1() {
        if (document.form1.userName.value == "") {
            alert("请输入用户名");
            return false;
        }
        if (document.form1.userPw.value.length < 6) {
            alert("密码需要大于6位");
            document.form1.userPw.focus();
            return;
        }
        if (document.form1.userPw.value != document.form1.userPw1.value) {
            alert("两次密码不一致");
            return false;
        }
        if (document.form1.userRealName.value.length < 2) {
            alert("请输入真实姓名");
            document.form1.userPw.focus();
            return;
        }
        var email = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
        if (document.form1.userEmail.value.length < 1 || !email.test(document.form1.userEmail.value)) {
            alert("请输入正确邮箱地址");
            document.form1.userEmail.focus();
            return;
        }
        document.form1.submit();
    }
</script>
<div class="container">
    <div class="row">
        <h1 style="text-align: center;padding-top: 40px">用户注册</h1>
    </div>
    <div class="row">
        <div class="col-md-3"></div>
        <div class="col-md-6" style="padding-top: 40px">
            <form id="reg" action="<%=path %>/userReg.action" name="form1" method="post">
                <div class="form-group row">
                    <label class="col-sm-2 form-control-label">用户名</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" name="userName" placeholder="">
                    </div>
                </div>
                <div class="form-group row">
                    <label class="col-sm-2 form-control-label">密码</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" name="userPw" placeholder="">
                    </div>
                </div>
                <div class="form-group row">
                    <label class="col-sm-2 form-control-label">确认密码</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" name="userPw1" placeholder="">
                    </div>
                </div>
                <div class="form-group row">
                    <label class="col-sm-2 form-control-label">真实姓名</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" name="userRealName" placeholder="">
                    </div>
                </div>
                <div class="form-group row">
                    <label class="col-sm-2 form-control-label">联系方式</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" name="userTel" placeholder="">
                    </div>
                </div>
                <div class="form-group row">
                    <label class="col-sm-2 form-control-label">E-mail</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" name="userEmail" placeholder="">
                    </div>
                </div>
                <div class="form-group row">
                    <label class="col-sm-2 form-control-label">QQ</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" name="userQq" placeholder="">
                    </div>
                </div>
                <div class="form-group row">
                    <div class="col-sm-10"></div>
                    <div class=" col-sm-2">
                        <input type="button" class="btn btn-success" onclick="check1()" value="注册"/>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>

<jsp:include flush="true" page="/view/inc/incFoot.jsp"/>
<!--foot -->	
